from pyeasyaccept.commom.FindScript import FindScript
from pyeasyaccept.commom.Configuration import Configuration
import unittest
import wx

class WalkPathTest(unittest.TestCase):
    """
    This class tests walk in a folder and find all scripts inside it
    @author: Mikaela Maia
    """
    def setUp(self): 
        """
        This method sets initial information
        """
        self.findScript = FindScript()
        self.configuration = Configuration.getInstance()
        self.FILE_SEPARATOR = Configuration.FILE_SEPARATOR          
        self.root = self.configuration.getProjectRoot()
       
    
    def tearDown(self):
        """
        This method tear down informations
        """
        pass
    
    def testWalkPath(self):
        """
        Tests walk in a folder that has scripts inside it
        """
        path1 = self.root + self.configuration.ACCEPTANCE_TEST_SCRIPTS_LOCATION
        numberOfScripts = 7
        self.assertEquals(numberOfScripts,len(self.findScript.getScripts(path1)))
        
    def testWalkEmptyFolder(self):
        """
        Tests walk in a folder that has not scripts inside it.
        """
        path2 = self.root + self.configuration.ICONS_LOCATION
        numberOfScripts = 0
        self.assertEquals(numberOfScripts,len(self.findScript.getScripts(path2)))
        
    def testWalkFolderInsideFolder(self):
        """
        Tests walk in a folder that has folders inside it with scripts.
        """
        path3 = self.root + self.configuration.FILE_SEPARATOR + "resources"
        numberOfScripts = 26
        self.assertEquals(numberOfScripts,len(self.findScript.getScripts(path3)))

if __name__ == '__main__':
    unittest.main() 
    